<?php
// +----------------------------------------------------------------------
// |img_list.php
// +----------------------------------------------------------------------
// |Data:2016-04-18 上午11:24
// +----------------------------------------------------------------------
// |Author: 吕志雄 <870923001@qq.com>
// +----------------------------------------------------------------------

//define('SITE_URL','http://'.strip_tags($_SERVER['HTTP_HOST']));
require 'Common.php';
$key = $_POST['key'];
$akey = $_POST['akey'];
$skey = $_POST['skey'];
$sig = $_POST['sig'];
$alias = $_POST['alias'];

if(empty($key) || empty($akey) || empty($skey) || empty($sig))
{
    throw new Exception("",'invalid_request');
}

$config_key = C('UPLOAD')['REMOTE_KEY'];
if($akey!=$config_key){
    throw new Exception("",'invalid_request_key');
}

$key = params_deal(SITE_URL);
$secret = get_secret($akey,$skey);
$new_sig = get_signature($key,$secret);
if($sig!=$new_sig){
    throw new Exception("",'invalid_request');
}

$del = new Del();
$file_list = $del->getFileLibrary($alias);
if(!empty($file_list)){
    $del->sortFileLibrary($file_list,$order='name');
}
exit(json_encode($file_list));

?>